<?php 
class DetechBrowser{
	public $ua, $android, $blackberry, $iphone, $palm, $linux, $mac;
	public $win, $chrome, $firefox, $firefox_2, $firefox_3, $firefox_3_6;
	public $msie, $msie_7, $msie_8, $opera, $safari, $safari_2, $safari_3;
	public $safari_3_1, $safari_4;
	public function init(){
		$ua = $_SERVER["HTTP_USER_AGENT"];
		$this->ua=$ua;
		// Android
		$this->android = $this->checker($ua, 'Android');
		
		// BlackBerry
		$this->blackberry = $this->checker($ua, 'BlackBerry');
		
		// iPhone
		$this->iphone = $this->checker($ua, 'iPhone');
		
		// Palm
		$this->palm = $this->checker($ua, 'Palm');
		
		// ---- Desktop ----
		
		// Linux
		$this->linux = $this->checker($ua, 'Linux');
		
		// Macintosh
		$this->mac = $this->checker($ua, 'Macintosh');
		
		// Windows
		$this->win = $this->checker($ua, 'Windows');
		
		/* ============================ */
		
		
		/* ==== Detect the UA ==== */
		
		// Chrome
		$this->chrome = $this->checker($ua, 'Chrome'); // Google Chrome
		
		// Firefox
		$this->firefox = $this->checker($ua, 'Firefox'); // All Firefox
		$this->firefox_2 = $this->checker($ua, 'Firefox/2.0'); // Firefox 2
		$this->firefox_3 = $this->checker($ua, 'Firefox/3.0'); // Firefox 3
		$this->firefox_3_6 = $this->checker($ua, 'Firefox/3.6'); // Firefox 3.6
		
		// Internet Exlporer
		$this->msie = $this->checker($ua, 'MSIE'); // All Internet Explorer
		$this->msie_7 = $this->checker($ua, 'MSIE 7.0'); // Internet Explorer 7
		$this->msie_8 = $this->checker($ua, 'MSIE 8.0'); // Internet Explorer 8
		
		// Opera
		$this->opera = preg_match("/\bOpera\b/i", $ua); // All Opera
		
		
		// Safari
		$this->safari = $this->checker($ua, 'Safari'); // All Safari
		$this->safari_2 = $this->checker($ua, 'Safari/419'); // Safari 2
		$this->safari_3 = $this->checker($ua, 'Safari/525'); // Safari 3
		$this->safari_3_1 = $this->checker($ua, 'Safari/528'); // Safari 3.1
		$this->safari_4 = $this->checker($ua, 'Safari/531'); // Safari 4
	}
	public function checker($ua, $istr){
		$str=strpos($ua, $istr);
		if(trim($str)==''){
			return false;	
		}else if($str>=0){
			return true;
		}
		
	}

	
/* ==== Detect the OS ==== */

// ---- Mobile ----


	
	
}

?>